package com.newlink.building.userinfo.mvp

import com.newlink.building.common_base.base.BasePresenter
import com.newlink.building.common_base.ext.ss
import com.newlink.building.userinfo.mvp.contract.Module_UserInfo_AccountInformationChangePhoneContract
import com.newlink.building.userinfo.mvp.model.Module_UserInfo_AccountInformationChangePhoneModel

/**
 * @author wangyang
 * @date 2022/10/29
 * @description 我的——账户信息——更换手机号页面（第一步：输入密码）的Presenter
 */
class Module_UserInfo_AccountInformationChangePhonePresenter :
    BasePresenter<Module_UserInfo_AccountInformationChangePhoneContract.Model, Module_UserInfo_AccountInformationChangePhoneContract.View>(),
    Module_UserInfo_AccountInformationChangePhoneContract.Presenter {

    override fun createModel(): Module_UserInfo_AccountInformationChangePhoneContract.Model? {
        return Module_UserInfo_AccountInformationChangePhoneModel()
    }

    override fun getData() {
    }

    override fun verifyPassword(accessToken: String, password: String) {
        mModel?.verifyPassword(accessToken, password)
            ?.ss(mModel, mView) { result ->
                result?.let {
                    if (result.data.result == 1) {
                        mView?.verifyPasswordSuccess()
                    } else {
                        mView?.verifyPasswordFailed(result.data.reason)
                    }
                }

            }
    }


}